<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" href="css/home.css">
		<link rel="stylesheet" href="css/base.css">
		<link rel="stylesheet" type="text/css" href="css/paging.css">
		<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="js/personInfro.js"></script>
		<script type="text/javascript" src="js/page/query.js"></script>
		<script type="text/javascript" src="js/page/paging.js"></script>
		<title>全部舆情</title>
	</head>

	<body>
		<div class="wholePublic-box">
			<div class="wholePublic-header clearfix">
				<div class="wholePublic-logo fl">
					<a href="index-logged.html"><img src="images/logo-2.png" /></a>
				</div>
				<div class="wholePublic-header-list fl">
					<ul class="clearfix">
						<li class="wholePublic-border" onclick="javascript:window.location='wholePublic-company.html'">全部舆情</li>
						<li onclick="javascript:window.location='my-custom.html'">舆情定制</li>
						<li onclick="javascript:window.location='analysis.html'">分析报告</li>
						<li onclick="javascript:window.location='thinkTank.html'">智库</li>
						<li onclick="javascript:window.location='contactUs.html'">联系我们</li>
					</ul>
				</div>
				<div class="wholePublic-header-right fr">
					<ul class="clearfix">
						<li id="line"><img src="images/line-2.png" /></li>
						<li onclick="javascript:window.location='my-custom.html'">我的定制</li>
						<li id="exit"><img src="images/exit-2.png" /></li>
						<li class="setting-icon">
							<a href="company-setting.html"><img src="images/setting-icon.png" /></a>
						</li>
					</ul>
				</div>
			</div>
			<div class="grcolor-box"></div>
			<div class="wholePublic-mainBody clearfix">

				<div class="wholePublic-leftContent wholePublic-part1 fl" id="col1">
					<ul>
						<li onclick="javascript:window.location='wholePublic-company.html'"><img src="images/company-icon.png" /><span>企业舆情</span></li>
						<li onclick="javascript:window.location='wholePublic-product.html'"><img src="images/product-icon.png" /><span>产品舆情</span></li>
						<li onclick="javascript:window.location='wholePublic-hot.html'"><img src="images/hot-icon.png" /><span>热点舆情</span></li>
						<li onclick="javascript:window.location='wholePublic-collection.html'" class="wholePublic-selected"><img src="images/collection-icon-selected.png" /><span>舆情收藏</span></li>
					</ul>
				</div>
				<div class="wholePublic-rightContent fl">

					<!--收藏舆情开始-->
					<div class="collection-box">
						<div class="media-header clearfix attribute-header">
							<dl class="fl attribute">
								<dt>属性</dt>
								<dd class="media-header-selected">全部</dd>
								<dd>正面</dd>
								<dd>负面</dd>
								<dd>中立</dd>
							</dl>
						</div>

						<!--一条数据-->
						<div class="forum_list">
							<!--<div class="clearfix collection-item positive-list">
								<div class="collection-left fl">
									<div class="fl positive">正</div>
									<p class="fl item-content2">
										<a href="#"><span class="item-content2-title">企雷达</span>产品正在试产试销中</a>
										<span class="item-content2-source">东方财富网</span>
									</p>
								</div>
								<div class="collection-right fr">
									<div class="forum_time fl grcolor">2018-03-22</div>
									<div class="fl hot">
										<div class="hot-progress">
											<div class="progress-val" id="bar_width">5642</div>
											<div class="progress-bar">
												<span class="progress-in" id="bar"></span>
											</div>
										</div>
									</div>
									<div class="fl collection-img">
										<span><img src="images/share-icon.png"/></span>
										<span class="clear"><img src="images/clear.png"/></span>
									</div>
								</div>
							</div>-->

							<!--两条数据-->
							<!--<div class="clearfix collection-item neutral-list">
								<div class="collection-left fl">
									<div class="fl neutral">中</div>
									<p class="fl item-content2">
										<a href="#"><span class="item-content2-title">企雷达</span>产品正在试产试销中</a>
										<span class="item-content2-source">东方财富网</span>
									</p>
								</div>
								<div class="collection-right fr">
									<div class="forum_time fl grcolor">2018-03-22</div>
									<div class="fl hot">
										<div class="hot-progress">
											<div class="progress-val" id="bar_width">5642</div>
											<div class="progress-bar">
												<span class="progress-in" id="bar"></span>
											</div>
										</div>
									</div>
									<div class="fl collection-img">
										<span><img src="images/share-icon.png"/></span>
										<span class="clear"><img src="images/clear.png"/></span>
									</div>
								</div>
							</div>-->

							<!--三条数据-->
							<!--<div class="clearfix collection-item negative-list">
								<div class="collection-left fl">
									<div class="fl negative">反</div>
									<p class="fl item-content2">
										<a href="#"><span class="item-content2-title">企雷达</span>产品正在试产试销中</a>
										<span class="item-content2-source">东方财富网</span>
									</p>
								</div>
								<div class="collection-right fr">
									<div class="forum_time fl grcolor">2018-03-22</div>
									<div class="fl hot">
										<div class="hot-progress">
											<div class="progress-val" id="bar_width">5642</div>
											<div class="progress-bar">
												<span class="progress-in" id="bar"></span>
											</div>
										</div>
									</div>
									<div class="fl collection-img">
										<span><img src="images/share-icon.png"/></span>
										<span class="clear"><img src="images/clear.png"/></span>
									</div>
								</div>
							</div>-->
						</div>
						<div id="pageToolBox" style="position: relative;">
							<div id="pageTool"></div>
						</div>
						<!--收藏舆情结束-->
					</div>
				</div>
			</div>
	</body>

</html>
<script>
	var total;
	var vals;
	var token = sessionStorage.getItem('token');
	var useraccount = JSON.parse(token).useraccount;
	var userid = JSON.parse(token).id;
	Resize = function() {
		var doc = document.documentElement;
		relHeight = (doc.clientHeight > doc.scrollHeight) ? doc.clientHeight : doc.scrollHeight; //获取屏幕高度和当前页面高度中的较大值  
		document.getElementById('col1').style.height = relHeight - 82 + 'px'; //id为bg的div就是我页面中的遮罩层
	}
	$(document).ready(function() {
		Resize();
	});
	//分页
	var pages = 1;
	var emotion;
	$('.attribute dd').click(function() {
		emotion=null;
		if($(this).index() == 2) {
			emotion = 1;
		} else if($(this).index() == 3) {
			emotion = 2;
		}else if($(this).index() == 4) {
			emotion = 0;
		} 
		pages = 1;
		myCollection($(this).index());
	});

	$('.attribute dd').eq(0).trigger('click');

	function myCollection(a,data) {
		vals = a;
		var data = JSON.stringify({
			'useraccount': useraccount,
			'pageNum': pages,
			'emotion':emotion,
			'pageSize': 20,
		});
		$.ajax({
			type: "post",
			url: 'http://139.224.208.224:8080/qi-radar/cpSensation/getCollections',
			dataType: 'json',
			contentType: "application/json ",
			data: data,
			asycn: false,
			success: function(data) {
				if(data.code == 0) {
					total = data.total;
					var data = data.data;
					console.log(data)
					var list = '';
					var newTime_hot = [];
					var year_hot = [];
					var month_hot = [];
					var day_hot = [];
					var time_hot = [];
					var times_hot = [];
					for(var i = 0; i < data.length; i++) {
						newTime_hot.push(new Date(data[i].ctime))
						year_hot.push(newTime_hot[i].getFullYear());
						month_hot.push(newTime_hot[i].getMonth() + 1);
						day_hot.push(newTime_hot[i].getDate());
						time_hot.push((year_hot[i] + "-" + month_hot[i] + "-" + day_hot[i]));
						times_hot.push(time_hot[i]);

						if(vals == 2) {
							if(data[i].emotion == 1) {
								list += "<div class=\"clearfix collection-item positive-list\">";
								list += "<div class=\"collection-left fl\">";
								list += "<div class=\"fl positive\">正</div>";
								list += "<p class=\"fl item-content2\">";
								list += "<a href=\"#\">" + data[i].vrtitle + "</a>";
								list += "</p>";
								list += "</div>";
								list += "<div class=\"collection-right fr\">";
								list += "<div class=\"forum_time fl grcolor\">" + times_hot[i] + "</div>";
								list += "<div class=\"fl hot\">";
								list += "<div class=\"hot-progress\">";
								list += "<div class=\"progress-val\" id=\"bar_width\">" + data[i].heat_value + "</div>";
								list += "<div class=\"progress-bar\">";
								list += "<span class=\"progress-in\" id=\"bar\"></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
								list += "<div class=\"fl collection-img\">";
								list += "<span><img src=\"images/share-icon.png\"/></span>";
								list += "<span class=\"clear\" ><img src=\"images/clear.png\" onclick=\"clear()\"/></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
							}
						} else if(vals == 3) {
							if(data[i].emotion == 2) {
								list += "<div class=\"clearfix collection-item positive-list\">";
								list += "<div class=\"collection-left fl\">";
								list += "<div class=\"fl negative\">负</div>";
								list += "<p class=\"fl item-content2\">";
								list += "<a href=\"#\">" + data[i].vrtitle + "</a>";
								list += "</p>";
								list += "</div>";
								list += "<div class=\"collection-right fr\">";
								list += "<div class=\"forum_time fl grcolor\">" + times_hot[i] + "</div>";
								list += "<div class=\"fl hot\">";
								list += "<div class=\"hot-progress\">";
								list += "<div class=\"progress-val\" id=\"bar_width\">" + data[i].heat_value + "</div>";
								list += "<div class=\"progress-bar\">";
								list += "<span class=\"progress-in\" id=\"bar\"></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
								list += "<div class=\"fl collection-img\">";
								list += "<span><img src=\"images/share-icon.png\"/></span>";
								list += "<span class=\"clear\"><img src=\"images/clear.png\" onclick=\"clear()\"/></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
							};
						} else if(vals == 4) {
							if(data[i].emotion == 0) {
								list += "<div class=\"clearfix collection-item positive-list\">";
								list += "<div class=\"collection-left fl\">";
								list += "<div class=\"fl neutral\">中</div>";
								list += "<p class=\"fl item-content2\">";
								list += "<a href=\"#\">" + data[i].vrtitle + "</a>";
								list += "</p>";
								list += "</div>";
								list += "<div class=\"collection-right fr\">";
								list += "<div class=\"forum_time fl grcolor\">" + times_hot[i] + "</div>";
								list += "<div class=\"fl hot\">";
								list += "<div class=\"hot-progress\">";
								list += "<div class=\"progress-val\" id=\"bar_width\">" + data[i].heat_value + "</div>";
								list += "<div class=\"progress-bar\">";
								list += "<span class=\"progress-in\" id=\"bar\"></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
								list += "<div class=\"fl collection-img\">";
								list += "<span><img src=\"images/share-icon.png\"/></span>";
								list += "<span class=\"clear\"><img src=\"images/clear.png\" onclick=\"clear()\" / ></span>";
								list += "</div>";
								list += "</div>";
								list += "</div>";
							}
						} else {
							list += "<div class=\"clearfix collection-item positive-list\">";
							list += "<div class=\"collection-left fl\">";
							if(data[i].emotion == 1) {
								list += "<div class=\"fl positive\">正</div>";
							} else if(data[i].emotion == 2) {
								list += "<div class=\"fl negative\">负</div>";
							} else {
								list += "<div class=\"fl neutral\">中</div>";
							}
							list += "<p class=\"fl item-content2\">";
							list += "<a href=\"#\">" + data[i].vrtitle + "</a>";
							list += "</p>";
							list += "</div>";
							list += "<div class=\"collection-right fr\">";
							list += "<div class=\"forum_time fl grcolor\">" + times_hot[i] + "</div>";
							list += "<div class=\"fl hot\">";
							list += "<div class=\"hot-progress\">";
							list += "<div class=\"progress-val\" id=\"bar_width\">" + data[i].heat_value + "</div>";
							list += "<div class=\"progress-bar\">";
							list += "<span class=\"progress-in\" id=\"bar\"></span>";
							list += "</div>";
							list += "</div>";
							list += "</div>";
							list += "<div class=\"fl collection-img\">";
							list += "<span><img src=\"images/share-icon.png\"/></span>";
							list += "<span class=\"clear\"><img src=\"images/clear.png\" onclick=\"del()\"/></span>";
							list += "</div>";
							list += "</div>";
							list += "</div>";
						}
					}
					$(".forum_list").html(list);
					if(total>10){
						$("#pageToolBox").show();
					};
					Resize();
					paged();
				} else {
					alert(data.errMsg)
				};
			}
		});
	};

	//分页多
	function paged() {
		$('#pageTool').Paging({
			pagesize: 20,
			count: total,
			current: pages,
			callback: function(page, size, count) {
				pages = page;
				myCollection(vals);
			}
		});
	};
	//删除一条我的收藏
	function del() {
		
	};
	window.onload = function() {
		Resize();
		window.onresize = function() {
			Resize()
		};
	};
</script>